<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跳转倒计时</title>
    <style>
        /* 给盒子一个样式 */
        .div1{
            width: 200px;
            height: 200px;
            background: rgba(128, 128, 128, 0.3);
            margin: 0 auto;
            border-radius: 50%;
            position: relative;
            top: 100px;
            text-align: center;
        }
        /* 控制秒数样式 */
        .number{
            font-size:100px;
            display: block;
            position: relative;
            top: 10px;
            font-weight: 900;
        }
        /* 跳转字体 */
        .skip{
            font-size: 14px;
            margin-top: 10px;
        }
        b{
            color:red;
            font-weight: 900;
        }
    </style>
</head>
<body>
    <div class="div1">
        <span class="number">10</span>
        <span class="skip"><b class="b">10</b>秒后将跳转到<b>百度网页</b></span>
    </div>
</body>
    <script>
        var time=10;
        // 查找节点（标签）
        var number=document.getElementsByClassName('number')[0];
        var b=document.getElementsByClassName('b')[0];

        //利用定时器
        window.setInterval(function(){
            // 判断描述是否为0，若为0,页面跳转
            if(time==0){
                location.href='https://www.baidu.com/';
            }
            else{
                --time;
                number.innerText=time;
                b.innerText=time;
            }
        },1000)
    </script>
</html>
